package titt.io.socket;

import titt.io.reader.head.HeadReader;
import titt.io.socket.in.TITTInputStream;
import titt.io.socket.out.TITTOutputStream;
import titt.io.writer.head.HeadWriter;

public class SwapHeadSocket implements TITTSocket {
	
	private TITTSocket s;

	private HeadReader hr;
	private HeadWriter hw;
	
	public SwapHeadSocket(TITTSocket s, HeadReader hr, HeadWriter hw) {
		this.hr = hr;
		this.hw = hw;
		this.s = s;
	}
	
	public SwapHeadSocket(TITTSocket s, HeadReader hr) {
		this(s, hr, s.getHeadWriter());
	}
	
	public SwapHeadSocket(TITTSocket s, HeadWriter hw) {
		this(s, s.getHeadReader(), hw);
	}
	
	@Override
	public void close() throws Exception {
		s.close();
	}
	
	@Override
	public void setTimeout(int timeout) throws Exception {
		s.setTimeout(timeout);
	}


	@Override
	public HeadReader getHeadReader() {
		return hr;
	}

	@Override
	public HeadWriter getHeadWriter() {
		return hw;
	}

	@Override
	public TITTInputStream getInputStream() {
		return s.getInputStream();
	}

	@Override
	public TITTOutputStream getOutputStream() {
		return s.getOutputStream();
	}

	@Override
	public boolean isClosed() {
		return s.isClosed();
	}

}
